From: Jackmcbarn Date: Thu, 29 May 2014 21:08:13 +0000 (-0400) Subject: Support {{!}} as a magic word X-Git-Tag: 1.31.0-rc.0~15209 X-Git-Url: http://git.cyclocoop.org/%28%5B%5E/404?a=commitdiff_plain;h=c313a75c801173295c6c8197e0210afc7f2cae7b;p=lhc%2Fweb%2Fwiklou.git Support {{!}} as a magic word Add {{!}} as a magic word that expands to a pipe. Parsoid already does this, so we know it isn't going to cause major breakage. Change-Id: I1f857417d224d6443504074a5add852df3975b89 --- diff --git a/RELEASE-NOTES-1.24 b/RELEASE-NOTES-1.24 index d8543b7594..c43e730f7d 100644 --- a/RELEASE-NOTES-1.24 +++ b/RELEASE-NOTES-1.24 @@ -92,6 +92,8 @@ production. * Browser tests are now included to verify basic wiki functionality in developer environments. For details on running tests, see tests/browser/README.mediawiki. * Upgrade jStorage to v0.4.10. +* {{!}} is now a magic word that produces the | character. This removes the need + for Template:! for purposes such as passing pipes inside of parameters. === Bug fixes in 1.24 === * (bug 49116) Footer copyright notice is now always displayed in user language diff --git a/includes/MagicWord.php b/includes/MagicWord.php index 3e327c3559..7decbee0ab 100644 --- a/includes/MagicWord.php +++ b/includes/MagicWord.php @@ -96,6 +96,7 @@ class MagicWord { static public $mVariableIDsInitialised = false; static public $mVariableIDs = array( + '!', 'currentmonth', 'currentmonth1', 'currentmonthname', diff --git a/includes/parser/Parser.php b/includes/parser/Parser.php index fa5d6788fa..eb7bd1b0c8 100644 --- a/includes/parser/Parser.php +++ b/includes/parser/Parser.php @@ -2820,6 +2820,9 @@ class Parser { $pageLang = $this->getFunctionLang(); switch ( $index ) { + case '!': + $value = '|'; + break; case 'currentmonth': $value = $pageLang->formatNum( MWTimestamp::getInstance( $ts )->format( 'm' ) ); break; diff --git a/languages/messages/MessagesEn.php b/languages/messages/MessagesEn.php index 07a0467aca..cabc89c887 100644 --- a/languages/messages/MessagesEn.php +++ b/languages/messages/MessagesEn.php @@ -209,6 +209,7 @@ $magicWords = array( 'forcetoc' => array( 0, '__FORCETOC__' ), 'toc' => array( 0, '__TOC__' ), 'noeditsection' => array( 0, '__NOEDITSECTION__' ), + '!' => array( 1, '!' ), 'currentmonth' => array( 1, 'CURRENTMONTH', 'CURRENTMONTH2' ), 'currentmonth1' => array( 1, 'CURRENTMONTH1' ), 'currentmonthname' => array( 1, 'CURRENTMONTHNAME' ), diff --git a/tests/parser/parserTests.txt b/tests/parser/parserTests.txt index 03e4959d0f..f6238bb804 100644 --- a/tests/parser/parserTests.txt +++ b/tests/parser/parserTests.txt @@ -87,12 +87,6 @@ Template:tbl-end |} !! endarticle -!! article -Template:! -!! text -| -!! endarticle - !! article Template:echo !! text